package com.itheima.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAdvice {

    @Pointcut("execution(void com.itheima.dao.impl.BookDaoImpl.update())")
    private void pt() {
    }

//    @Before("pt()")
//    public  void method(){
//        System.out.println(System.currentTimeMillis());
//    }


    @Around("pt()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("around before advice");
        Object ret = pjp.proceed();
        System.out.println("around after advice");
        return ret;
    }
}
